<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>ArcGIS API for JavaScript Tutorials: Create a Starter App</title>
    <style>
        html, body, #viewDiv {
            padding: 0;
            margin: 0;
            height: 100%;
            width: 100%;
        }
    </style>

    <link rel="stylesheet" href="https://js.arcgis.com/4.16/esri/themes/light/main.css">
    <script src="https://js.arcgis.com/4.16/"></script>

    <script>
        require([
            "esri/Map",
            "esri/views/MapView",
            "esri/layers/FeatureLayer"
        ], function (Map, MapView, FeatureLayer) {

            let map = new Map({
                basemap: "topo-vector"
            });

            let view = new MapView({
                container: "viewDiv",
                map: map,
                center: [-118.80500, 34.02700], // longitude, latitude
                zoom: 13
            });

            // Trailheads feature layer (points)
            let trailheadsLayer = new FeatureLayer({
                url: "https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Trailheads/FeatureServer/0"
            });

            map.add(trailheadsLayer)

            // Trails feature layer (lines)
            let trailsLayer = new FeatureLayer({
                url: "https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Trails/FeatureServer/0",

                renderer: {
                    type: "simple",
                    symbol: {
                        type: "simple-line",
                        color: "green",
                        width: "2px"
                    }
                },

                outFields: ["TRL_NAME","ELEV_GAIN"],

                popupTemplate: {  // Enable a popup
                    title: "{TRL_NAME}", // Show attribute value
                    content: "The trail elevation gain is {ELEV_GAIN} ft."  // Display text in pop-up
                }
            });

            map.add(trailsLayer, 0);

            // Parks and open spaces (polygons)
            var parksLayer = new FeatureLayer({
                url: "https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Parks_and_Open_Space/FeatureServer/0"
            });

            map.add(parksLayer, 0);
        });
    </script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html>